﻿namespace DesignModeConsole.结构型.装饰器模式;

/// <summary>
/// 人的类  concreteComponent
/// </summary>
public class Persion
{
    public Persion()
    {
    }
    private readonly string name;
    public Persion(string name)
    {
        this.name = name;
    }

    public virtual void Show()
    {
        Console.WriteLine("装扮的{0}", name);
    }
}

/// <summary>
/// 服饰类（Decorator）
/// </summary>
public class Finery : Persion
{
    private Persion _component;

    public void Decorate(Persion persion)
    {
        _component = persion;
    }

    public override void Show()
    {
        _component?.Show();
    }
}

#region 具体服饰类(concreteDecorator)

public class TShirts : Finery
{
    public override void Show()
    {
        Console.WriteLine("大T恤");
        base.Show();
    }
}

public class BigTrouser : Finery
{
    public override void Show()
    {
        Console.WriteLine("垮裤");
        base.Show();
    }
}


#endregion